package com.ist.smartvehicle;

import com.ist.smartvehicle.road.Map;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;


public class SmartVehicle extends Activity implements LocationListener {
	
	private static final int MAP_ID = Menu.FIRST;
	
	public Location currentLocation;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
//		LocationManager locationManager = (LocationManager) getSystemService(
//				Context.LOCATION_SERVICE);
//		locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
//				0, this);
//		currentLocation = new Location(locationManager
//				.getLastKnownLocation(LocationManager.GPS_PROVIDER));

    }
    
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		menu.add(0, MAP_ID, 0, "Map");//.setIcon(R.drawable.info);
		return true;
	}

	@Override
	public boolean onMenuItemSelected(int featureId, MenuItem item) {
		switch(item.getItemId()) {
		case MAP_ID:
			Intent map = new Intent(this, Map.class);
//			map.getExtras().putParcelable("location", currentLocation);
			startActivity(map);
			return true;
		}
		return super.onMenuItemSelected(featureId, item);
	}

	@Override
	public void onLocationChanged(Location location) {
		currentLocation = location;
	}

	@Override
	public void onProviderDisabled(String provider) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onProviderEnabled(String provider) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onStatusChanged(String provider, int status, Bundle extras) {
		// TODO Auto-generated method stub
		
	}
    
}